package com.lebang.model.enums;

/**
 * @Author: hwq
 * @Date: 2020/7/27 11:18
 * @Version 1.0
 */
public enum  OsVersionEnum {
    ANDROID_10("安卓10", 1),
    ANDROID_1_9("安卓10以下", 0);

    private String title;
    private int index;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    private OsVersionEnum(String title, int index) {
        this.title = title;
        this.index = index;
    }

    public OsVersionEnum getByIndex(int index) {
        for (OsVersionEnum e : OsVersionEnum.values()) {
            if (e.index == index) {
                return e;
            }
        }
        return null;
    }

    public OsVersionEnum getByTitle(String title) {
        if (null == title) {
            return null;
        }
        for (OsVersionEnum e : OsVersionEnum.values()) {
            if (e.title.equals(title)) {
                return e;
            }
        }
        return null;
    }
}
